package com.wstx.mediaserver.common;

import cn.hutool.core.util.RuntimeUtil;
import com.wstx.mediaserver.config.MyConfig;
import lombok.Getter;
import org.apache.commons.lang3.SystemUtils;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
@Getter
public class AppVar {
    public String ip;
    public int uploadProxyPort;
    public String vmIp;
    public int recordProxyPort;

    @PostConstruct
    public void init() {
        uploadProxyPort = Integer.parseInt(MyConfig.getConfig("upload.proxy.port"));
        recordProxyPort = Integer.parseInt(MyConfig.getConfig("record.proxy.port"));
        vmIp = MyConfig.getConfig("vm.ip");

        if (SystemUtils.IS_OS_LINUX){
            ip = MyConfig.getConfig("cloud.ip");
        }else {
            ip = "localhost";
        }
    }

}
